package edu.cuit.svsp.service.impl;

import edu.cuit.svsp.mapper.LikeMapper;
import edu.cuit.svsp.service.LikeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @className: LikeServiceImpl
 * @author: pjy
 * @description: 喜欢服务实现类
 * @date: 2024/7/6
 */
@Service
public class LikeServiceImpl implements LikeService {

    @Resource
    private LikeMapper likeMapper;
    @Transactional
    @Override
    public boolean updateLike(boolean isUp, Integer vid, Integer uid) {
        if(isUp){
            likeMapper.addLike(vid,uid);
        }else {
            likeMapper.dellike(vid,uid);
        }

        return true;
    }

    @Override
    public boolean findLike(Integer vid, int uid) {
        return likeMapper.findLike(vid,uid);
    }
}
